<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.16"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>LibTools: H:/project/LibTools/src/framework/tcp/framework/Service.cpp 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">LibTools
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.16 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','搜索');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a class="el" href="dir_5752cadd8276ecfd63d9b924f2a4d4b5.html">framework</a></li><li class="navelem"><a class="el" href="dir_c67741c6509c9bd4aec6faa9fd694608.html">tcp</a></li><li class="navelem"><a class="el" href="dir_cf0ab36ee90451b75992f2af7ab5af86.html">framework</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">Service.cpp</div>  </div>
</div><!--header-->
<div class="contents">
<a href="_service_8cpp.html">浏览该文件的文档.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="preprocessor">#include &quot;../../../socket/internal/IoPortService.h&quot;</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="preprocessor">#include &quot;../../../socket/TcpIoServer.h&quot;</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="preprocessor">#include &quot;../../../socket/TcpIoSocket.h&quot;</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="preprocessor">#include &quot;../../../socket/Timer.h&quot;</span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="preprocessor">#include &quot;../../../stream/StringTools.h&quot;</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="preprocessor">#include &quot;../ClassFactory.h&quot;</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_service_8h.html">Service.h</a>&quot;</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="_client_8h.html">Client.h</a>&quot;</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160; </div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<a class="code" href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160; </div>
<div class="line"><a name="l00013"></a><span class="lineno"><a class="line" href="class_service.html#ae3887d7d725c94f207a479a10cce30bd">   13</a></span>&#160;<a class="code" href="class_service.html#ae3887d7d725c94f207a479a10cce30bd">Service::Service</a>() : _config(new <a class="code" href="class_tcp_config.html">TcpConfig</a>), _mgr(new  <a class="code" href="class_c_safe_map.html">CSafeMap</a>&lt;<a class="code" href="_sock_tools_8h.html#ac7875a7f6984241a06892f7041b4d30a">SOCKIDEN</a>, <a class="code" href="class_shared_ptr.html">SharedPtr</a>&lt;<a class="code" href="class_client.html">Client</a>&gt; &gt;()), _isServer(true)</div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;{</div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;}</div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno"><a class="line" href="class_service.html#af6c3577b59652ac817d1d76aaccee904">   17</a></span>&#160;<a class="code" href="class_service.html#af6c3577b59652ac817d1d76aaccee904">Service::~Service</a>()</div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;{</div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>) <span class="keyword">delete</span> <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>;</div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;    <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a> = <a class="code" href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a>;</div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;}</div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160; </div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// void Service::DeleteClient(Client* c)</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;<span class="comment">// {</span></div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="comment">//  _mgr-&gt;Erase(c-&gt;GetSocketIden());</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="comment">// }</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160; </div>
<div class="line"><a name="l00028"></a><span class="lineno"><a class="line" href="class_service.html#a3cac6e8d20e95f043d56d83e3ddd33bc">   28</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_service.html#a3cac6e8d20e95f043d56d83e3ddd33bc">Service::DeleteClient</a>(<a class="code" href="_sock_tools_8h.html#ac7875a7f6984241a06892f7041b4d30a">SOCKIDEN</a> <span class="keywordtype">id</span>)</div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;{</div>
<div class="line"><a name="l00030"></a><span class="lineno">   30</span>&#160;    <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>-&gt;<a class="code" href="class_c_safe_map.html#a786c75f6b3b364940bd43e96ecda0d41">Erase</a>(<span class="keywordtype">id</span>);</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;}</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160; </div>
<div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="class_service.html#a1f2080b05bc4a1a5642b7fba69d7f0d2">   33</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_service.html#a1f2080b05bc4a1a5642b7fba69d7f0d2">Service::PopClient</a>(<a class="code" href="class_shared_ptr.html">SharedPtr&lt;Client&gt;</a>&amp; c)</div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;{</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>-&gt;<a class="code" href="class_c_safe_map.html#aac4e0d268555f9137e2c9d1e939f6a95">Pop</a>(c);</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160;}</div>
<div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160; </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="class_service.html#a26b720587403b9fe88c7b122ebab3553">   38</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_service.html#a26b720587403b9fe88c7b122ebab3553">Service::Clear</a>()</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;{</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;    <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>-&gt;<a class="code" href="class_c_safe_map.html#af58b78ecc0c618a603e8e023759b4ef8">Clear</a>();</div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;}</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160; </div>
<div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="class_service.html#a36e6b17fa4ed3d5582a4d5bc8e6da4f4">   43</a></span>&#160;<a class="code" href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a> <a class="code" href="class_service.html#a3cac6e8d20e95f043d56d83e3ddd33bc">Service::DeleteClient</a>(<span class="keywordtype">void</span>* invoker)</div>
<div class="line"><a name="l00044"></a><span class="lineno">   44</span>&#160;{</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    this-&gt;<a class="code" href="class_service.html#a3cac6e8d20e95f043d56d83e3ddd33bc">DeleteClient</a>((<a class="code" href="_sock_tools_8h.html#ac7875a7f6984241a06892f7041b4d30a">SOCKIDEN</a>)invoker);</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;    <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;}</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160; </div>
<div class="line"><a name="l00049"></a><span class="lineno"><a class="line" href="class_service.html#aceb078ac7bb78b45f21e0a3d2bf79735">   49</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_service.html#aceb078ac7bb78b45f21e0a3d2bf79735">Service::AddClient</a>(<span class="keyword">const</span> <a class="code" href="class_shared_ptr.html">SharedPtr&lt;Client&gt;</a>&amp; c)</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;{</div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160;    <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>-&gt;<a class="code" href="class_c_safe_map.html#a8488f9453a01639d4c7b53e3757875d6">Insert</a>(c-&gt;<a class="code" href="class_client.html#a8f2e8a7927adb30f14a28dc6d606e941">GetSocketIden</a>(), c);</div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;}</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160; </div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="class_service.html#ab4f45cb83a28907849da7897f7a30016">   54</a></span>&#160;<span class="keywordtype">size_t</span> <a class="code" href="class_service.html#ab4f45cb83a28907849da7897f7a30016">Service::GetSize</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>-&gt;<a class="code" href="class_c_safe_map.html#ab92562ab690d28ba0a70516974381853">Size</a>();</div>
<div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;}</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160; </div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="class_service.html#a94ef51dae18339e99ea55a67c3b00451">   59</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_service.html#a94ef51dae18339e99ea55a67c3b00451">Service::IsExistClient</a>(<span class="keyword">const</span> std::string&amp; iden)<span class="keyword"> const</span></div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;    std::vector&lt;std::string&gt; flags;</div>
<div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    <a class="code" href="_string_tools_8cpp.html#a9ee1de8dc109d12ae2bcfc653dd66401">split</a>(iden, (<span class="keywordtype">int</span>)<span class="charliteral">&#39;|&#39;</span>, flags);</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    <span class="keywordflow">if</span> (flags.size() == 2)</div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    {</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;        <span class="keywordflow">if</span> (flags[0] == <a class="code" href="class_service.html#a307f7bf977f0a39c8675fb42bc204e36">_serviceFlag</a>.GetReference())</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;        {</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;            <span class="keywordflow">return</span> <a class="code" href="class_service.html#a5155a095380842a32c022fe9c9854ffd">_mgr</a>-&gt;<a class="code" href="class_c_safe_map.html#a3a6a6bf2b2833c8fa83f3dc69992937c">Find</a>(<a class="code" href="_string_tools_8cpp.html#a291e8a294f62c123e11a298688172546">LibTools::stoll</a>(iden));</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;        }</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;    }</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160; </div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;}</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160; </div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="class_service.html#a87a64eeb17b61e794c1651d2de93f49b">   74</a></span>&#160;<span class="keywordtype">bool</span> <a class="code" href="class_service.html#a87a64eeb17b61e794c1651d2de93f49b">Service::IsServiceFlag</a>(<span class="keyword">const</span> std::string&amp; iden)<span class="keyword"> const</span></div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    std::vector&lt;std::string&gt; flags;</div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <a class="code" href="_string_tools_8cpp.html#a9ee1de8dc109d12ae2bcfc653dd66401">split</a>(iden, (<span class="keywordtype">int</span>)<span class="charliteral">&#39;|&#39;</span>, flags);</div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <span class="keywordflow">if</span> (flags.size() == 2)</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    {</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;        <span class="keywordflow">if</span> (flags[0] == <a class="code" href="class_service.html#a307f7bf977f0a39c8675fb42bc204e36">_serviceFlag</a>.GetReference())</div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;        {</div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;            <span class="keywordflow">return</span> <span class="keyword">true</span>;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;        }</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    }</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160; </div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <span class="keywordflow">return</span> <span class="keyword">false</span>;</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;}</div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160; </div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;<span class="comment">/*SharedPtr&lt;Client&gt; Service::GetClient(const std::string&amp; iden)</span></div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;<span class="comment">{</span></div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;<span class="comment">    std::vector&lt;std::string&gt; flags;</span></div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;<span class="comment">    split(iden, (int)&#39;|&#39;, flags);</span></div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;<span class="comment">    if (flags.size() == 2)</span></div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;<span class="comment">    {</span></div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="comment">        if (flags[0] == _serviceFlag.GetReference())</span></div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;<span class="comment">        {</span></div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;<span class="comment">            CLockGurad lk(&amp;_mgr-&gt;_mutexMap);</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;<span class="comment">            std::map&lt;SOCKIDEN, SharedPtr&lt;Client&gt; &gt;::iterator it = _mgr-&gt;_mapData.find(LibTools::stoll(flags[1]));</span></div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;<span class="comment">            if (it != _mgr-&gt;_mapData.end())</span></div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;<span class="comment">            {</span></div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="comment">                SharedPtr&lt;Client&gt; rtn = it-&gt;second;</span></div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;<span class="comment">                return rtn;</span></div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;<span class="comment">            }</span></div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;<span class="comment">        }</span></div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;<span class="comment">    }</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;<span class="comment"></span> </div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;<span class="comment">    return SharedPtr&lt;Client&gt;(NullPtr);</span></div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;<span class="comment">}*/</span></div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160; </div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="line" href="class_service.html#aede679dc4ce20dbe8fc56d9998727ef5">  110</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="class_service.html#aede679dc4ce20dbe8fc56d9998727ef5">Service::SetServiceFlag</a>(<span class="keyword">const</span> std::string&amp; flag)</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;{</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160;    <a class="code" href="class_service.html#a307f7bf977f0a39c8675fb42bc204e36">_serviceFlag</a>.GetReference() = flag;</div>
<div class="line"><a name="l00113"></a><span class="lineno">  113</span>&#160;}</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160; </div>
<div class="line"><a name="l00115"></a><span class="lineno"><a class="line" href="class_service.html#ae091318f2a5a2708d1631670e8bce6c0">  115</a></span>&#160;std::string <a class="code" href="class_service.html#ae091318f2a5a2708d1631670e8bce6c0">Service::GetServiceFlag</a>()<span class="keyword"> const</span></div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="class_service.html#a307f7bf977f0a39c8675fb42bc204e36">_serviceFlag</a>.GetReference();</div>
<div class="line"><a name="l00118"></a><span class="lineno">  118</span>&#160;}</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160; </div>
<div class="line"><a name="l00120"></a><span class="lineno"><a class="line" href="class_service.html#a040c5f1db96aad100bb713db069bc19e">  120</a></span>&#160;std::string <a class="code" href="class_service.html#a040c5f1db96aad100bb713db069bc19e">Service::GetClientIden</a>(<a class="code" href="class_client.html">Client</a>* c)<span class="keyword"> const</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;<span class="keyword"></span>{</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    std::string sockId;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    <span class="keywordflow">if</span> (c)</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    {</div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;<span class="preprocessor">#ifdef WIN32</span></div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;        sockId = <a class="code" href="tools_8h.html#acc6d8511211e23ff33647d261f6f8b59">STD_MOVE</a>(<a class="code" href="_string_tools_8cpp.html#accff640a08f04f7443e0da4eb25a4cf0">format_s</a>(32, <span class="stringliteral">&quot;%s|%I64d&quot;</span>, <a class="code" href="class_service.html#a307f7bf977f0a39c8675fb42bc204e36">_serviceFlag</a>.GetReference().c_str(), c-&gt;<a class="code" href="class_client.html#a8f2e8a7927adb30f14a28dc6d606e941">GetSocketIden</a>()));</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;<span class="preprocessor">#elif defined(LINUX)</span></div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;        sockId = <a class="code" href="tools_8h.html#acc6d8511211e23ff33647d261f6f8b59">STD_MOVE</a>(<a class="code" href="_string_tools_8cpp.html#accff640a08f04f7443e0da4eb25a4cf0">format_s</a>(32, <span class="stringliteral">&quot;%s|%lld&quot;</span>, <a class="code" href="class_service.html#a307f7bf977f0a39c8675fb42bc204e36">_serviceFlag</a>.GetReference().c_str(), c-&gt;<a class="code" href="class_client.html#a8f2e8a7927adb30f14a28dc6d606e941">GetSocketIden</a>()));</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;    }</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160; </div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="tools_8h.html#acc6d8511211e23ff33647d261f6f8b59">STD_MOVE</a>(sockId);</div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;}</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160; </div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;<a class="code" href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="a_string_tools_8cpp_html_accff640a08f04f7443e0da4eb25a4cf0"><div class="ttname"><a href="_string_tools_8cpp.html#accff640a08f04f7443e0da4eb25a4cf0">format_s</a></div><div class="ttdeci">std::string LIBTOOLS format_s(size_t bufSize, const char *mat,...)</div><div class="ttdef"><b>Definition:</b> <a href="_string_tools_8cpp_source.html#l00147">StringTools.cpp:147</a></div></div>
<div class="ttc" id="aclass_service_html_a307f7bf977f0a39c8675fb42bc204e36"><div class="ttname"><a href="class_service.html#a307f7bf977f0a39c8675fb42bc204e36">Service::_serviceFlag</a></div><div class="ttdeci">StringImp&lt; std::string &gt; _serviceFlag</div><div class="ttdoc">服务前缀标志</div><div class="ttdef"><b>Definition:</b> <a href="_service_8h_source.html#l00113">Service.h:113</a></div></div>
<div class="ttc" id="aclass_service_html_a3cac6e8d20e95f043d56d83e3ddd33bc"><div class="ttname"><a href="class_service.html#a3cac6e8d20e95f043d56d83e3ddd33bc">Service::DeleteClient</a></div><div class="ttdeci">void DeleteClient(SOCKIDEN id)</div><div class="ttdoc">删除客户端</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00028">Service.cpp:28</a></div></div>
<div class="ttc" id="aclass_c_safe_map_html"><div class="ttname"><a href="class_c_safe_map.html">CSafeMap</a></div><div class="ttdoc">线程安全的映射类</div><div class="ttdef"><b>Definition:</b> <a href="_safe_map_8h_source.html#l00014">SafeMap.h:14</a></div></div>
<div class="ttc" id="aclass_client_html_a8f2e8a7927adb30f14a28dc6d606e941"><div class="ttname"><a href="class_client.html#a8f2e8a7927adb30f14a28dc6d606e941">Client::GetSocketIden</a></div><div class="ttdeci">virtual SOCKIDEN GetSocketIden() const</div><div class="ttdoc">获取socket id</div><div class="ttdef"><b>Definition:</b> <a href="_client_8cpp_source.html#l00041">Client.cpp:41</a></div></div>
<div class="ttc" id="aclass_service_html_a94ef51dae18339e99ea55a67c3b00451"><div class="ttname"><a href="class_service.html#a94ef51dae18339e99ea55a67c3b00451">Service::IsExistClient</a></div><div class="ttdeci">bool IsExistClient(const std::string &amp;iden) const</div><div class="ttdoc">通过id, 查找客户端是否存在</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00059">Service.cpp:59</a></div></div>
<div class="ttc" id="aclass_service_html_af6c3577b59652ac817d1d76aaccee904"><div class="ttname"><a href="class_service.html#af6c3577b59652ac817d1d76aaccee904">Service::~Service</a></div><div class="ttdeci">virtual ~Service()</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00017">Service.cpp:17</a></div></div>
<div class="ttc" id="aclass_shared_ptr_html"><div class="ttname"><a href="class_shared_ptr.html">SharedPtr</a></div><div class="ttdoc">智能指针</div><div class="ttdef"><b>Definition:</b> <a href="_shared_ptr_8h_source.html#l00119">SharedPtr.h:119</a></div></div>
<div class="ttc" id="a_sock_tools_8h_html_ac7875a7f6984241a06892f7041b4d30a"><div class="ttname"><a href="_sock_tools_8h.html#ac7875a7f6984241a06892f7041b4d30a">SOCKIDEN</a></div><div class="ttdeci">DEF_BEG_LIBTOOLS typedef INT64 SOCKIDEN</div><div class="ttdoc">SOCKET唯一标识符ID</div><div class="ttdef"><b>Definition:</b> <a href="_sock_tools_8h_source.html#l00019">SockTools.h:19</a></div></div>
<div class="ttc" id="atools_8h_html_a201ce692c9dca6599e5c12d00167419b"><div class="ttname"><a href="tools_8h.html#a201ce692c9dca6599e5c12d00167419b">DEF_BEG_LIBTOOLS</a></div><div class="ttdeci">#define DEF_BEG_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00036">tools.h:36</a></div></div>
<div class="ttc" id="aclass_tcp_config_html"><div class="ttname"><a href="class_tcp_config.html">TcpConfig</a></div><div class="ttdoc">客户端配置类</div><div class="ttdef"><b>Definition:</b> <a href="_tcp_conf_8h_source.html#l00018">TcpConf.h:18</a></div></div>
<div class="ttc" id="aclass_service_html_a1f2080b05bc4a1a5642b7fba69d7f0d2"><div class="ttname"><a href="class_service.html#a1f2080b05bc4a1a5642b7fba69d7f0d2">Service::PopClient</a></div><div class="ttdeci">bool PopClient(SharedPtr&lt; Client &gt; &amp;c)</div><div class="ttdoc">获取一个客户端</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00033">Service.cpp:33</a></div></div>
<div class="ttc" id="aclass_service_html_a26b720587403b9fe88c7b122ebab3553"><div class="ttname"><a href="class_service.html#a26b720587403b9fe88c7b122ebab3553">Service::Clear</a></div><div class="ttdeci">void Clear()</div><div class="ttdoc">清空所有客户端</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00038">Service.cpp:38</a></div></div>
<div class="ttc" id="aclass_c_safe_map_html_a3a6a6bf2b2833c8fa83f3dc69992937c"><div class="ttname"><a href="class_c_safe_map.html#a3a6a6bf2b2833c8fa83f3dc69992937c">CSafeMap::Find</a></div><div class="ttdeci">bool Find(const Kt &amp;key)</div><div class="ttdoc">查找键值是否存在</div><div class="ttdef"><b>Definition:</b> <a href="_safe_map_8h_source.html#l00087">SafeMap.h:87</a></div></div>
<div class="ttc" id="aclass_c_safe_map_html_a8488f9453a01639d4c7b53e3757875d6"><div class="ttname"><a href="class_c_safe_map.html#a8488f9453a01639d4c7b53e3757875d6">CSafeMap::Insert</a></div><div class="ttdeci">void Insert(const Kt &amp;key, const Vt &amp;value)</div><div class="ttdoc">插入一个元素</div><div class="ttdef"><b>Definition:</b> <a href="_safe_map_8h_source.html#l00018">SafeMap.h:18</a></div></div>
<div class="ttc" id="aclass_service_html_a5155a095380842a32c022fe9c9854ffd"><div class="ttname"><a href="class_service.html#a5155a095380842a32c022fe9c9854ffd">Service::_mgr</a></div><div class="ttdeci">CSafeMap&lt; SOCKIDEN, SharedPtr&lt; Client &gt; &gt; * _mgr</div><div class="ttdoc">客户端管理</div><div class="ttdef"><b>Definition:</b> <a href="_service_8h_source.html#l00115">Service.h:115</a></div></div>
<div class="ttc" id="atools_8h_html_ac909db71799bb22cb7d636a34cd785e4"><div class="ttname"><a href="tools_8h.html#ac909db71799bb22cb7d636a34cd785e4">DEF_END_LIBTOOLS</a></div><div class="ttdeci">#define DEF_END_LIBTOOLS</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00038">tools.h:38</a></div></div>
<div class="ttc" id="a_client_8h_html"><div class="ttname"><a href="_client_8h.html">Client.h</a></div></div>
<div class="ttc" id="aclass_c_safe_map_html_af58b78ecc0c618a603e8e023759b4ef8"><div class="ttname"><a href="class_c_safe_map.html#af58b78ecc0c618a603e8e023759b4ef8">CSafeMap::Clear</a></div><div class="ttdeci">void Clear()</div><div class="ttdoc">清空所有元素</div><div class="ttdef"><b>Definition:</b> <a href="_safe_map_8h_source.html#l00036">SafeMap.h:36</a></div></div>
<div class="ttc" id="aclass_c_safe_map_html_aac4e0d268555f9137e2c9d1e939f6a95"><div class="ttname"><a href="class_c_safe_map.html#aac4e0d268555f9137e2c9d1e939f6a95">CSafeMap::Pop</a></div><div class="ttdeci">bool Pop(Vt &amp;value)</div><div class="ttdoc">删除第一个元素元素</div><div class="ttdef"><b>Definition:</b> <a href="_safe_map_8h_source.html#l00047">SafeMap.h:47</a></div></div>
<div class="ttc" id="aclass_service_html_a040c5f1db96aad100bb713db069bc19e"><div class="ttname"><a href="class_service.html#a040c5f1db96aad100bb713db069bc19e">Service::GetClientIden</a></div><div class="ttdeci">std::string GetClientIden(Client *c) const</div><div class="ttdoc">生成客户端标志</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00120">Service.cpp:120</a></div></div>
<div class="ttc" id="aclass_service_html_ab4f45cb83a28907849da7897f7a30016"><div class="ttname"><a href="class_service.html#ab4f45cb83a28907849da7897f7a30016">Service::GetSize</a></div><div class="ttdeci">size_t GetSize() const</div><div class="ttdoc">获取客户端大小</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00054">Service.cpp:54</a></div></div>
<div class="ttc" id="aclass_service_html_ae091318f2a5a2708d1631670e8bce6c0"><div class="ttname"><a href="class_service.html#ae091318f2a5a2708d1631670e8bce6c0">Service::GetServiceFlag</a></div><div class="ttdeci">std::string GetServiceFlag() const</div><div class="ttdoc">获取服务标志</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00115">Service.cpp:115</a></div></div>
<div class="ttc" id="a_string_tools_8cpp_html_a291e8a294f62c123e11a298688172546"><div class="ttname"><a href="_string_tools_8cpp.html#a291e8a294f62c123e11a298688172546">stoll</a></div><div class="ttdeci">long long stoll(const std::string &amp;str)</div><div class="ttdef"><b>Definition:</b> <a href="_string_tools_8cpp_source.html#l00236">StringTools.cpp:236</a></div></div>
<div class="ttc" id="a_service_8h_html"><div class="ttname"><a href="_service_8h.html">Service.h</a></div></div>
<div class="ttc" id="atools_8h_html_a798af1e30bc65f319c1a246cecf59e39"><div class="ttname"><a href="tools_8h.html#a798af1e30bc65f319c1a246cecf59e39">DWORD</a></div><div class="ttdeci">unsigned int DWORD</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00134">tools.h:134</a></div></div>
<div class="ttc" id="aclass_service_html_a87a64eeb17b61e794c1651d2de93f49b"><div class="ttname"><a href="class_service.html#a87a64eeb17b61e794c1651d2de93f49b">Service::IsServiceFlag</a></div><div class="ttdeci">bool IsServiceFlag(const std::string &amp;iden) const</div><div class="ttdoc">通过客户端标志判断服务标志是否为此服务</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00074">Service.cpp:74</a></div></div>
<div class="ttc" id="atools_8h_html_ab689500aaec0db066e3ac9483d3fe425"><div class="ttname"><a href="tools_8h.html#ab689500aaec0db066e3ac9483d3fe425">NullPtr</a></div><div class="ttdeci">#define NullPtr</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00119">tools.h:119</a></div></div>
<div class="ttc" id="aclass_service_html_ae3887d7d725c94f207a479a10cce30bd"><div class="ttname"><a href="class_service.html#ae3887d7d725c94f207a479a10cce30bd">Service::Service</a></div><div class="ttdeci">Service()</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00013">Service.cpp:13</a></div></div>
<div class="ttc" id="aclass_c_safe_map_html_ab92562ab690d28ba0a70516974381853"><div class="ttname"><a href="class_c_safe_map.html#ab92562ab690d28ba0a70516974381853">CSafeMap::Size</a></div><div class="ttdeci">std::size_t Size()</div><div class="ttdoc">返回当前大小</div><div class="ttdef"><b>Definition:</b> <a href="_safe_map_8h_source.html#l00080">SafeMap.h:80</a></div></div>
<div class="ttc" id="atools_8h_html_acc6d8511211e23ff33647d261f6f8b59"><div class="ttname"><a href="tools_8h.html#acc6d8511211e23ff33647d261f6f8b59">STD_MOVE</a></div><div class="ttdeci">#define STD_MOVE(object)</div><div class="ttdef"><b>Definition:</b> <a href="tools_8h_source.html#l00043">tools.h:43</a></div></div>
<div class="ttc" id="aclass_service_html_aede679dc4ce20dbe8fc56d9998727ef5"><div class="ttname"><a href="class_service.html#aede679dc4ce20dbe8fc56d9998727ef5">Service::SetServiceFlag</a></div><div class="ttdeci">void SetServiceFlag(const std::string &amp;flag)</div><div class="ttdoc">设置服务标志,只能为数字或者字母</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00110">Service.cpp:110</a></div></div>
<div class="ttc" id="a_string_tools_8cpp_html_a9ee1de8dc109d12ae2bcfc653dd66401"><div class="ttname"><a href="_string_tools_8cpp.html#a9ee1de8dc109d12ae2bcfc653dd66401">split</a></div><div class="ttdeci">size_t split(const std::string &amp;str, int spchr, std::vector&lt; std::string &gt; &amp;strs)</div><div class="ttdef"><b>Definition:</b> <a href="_string_tools_8cpp_source.html#l00200">StringTools.cpp:200</a></div></div>
<div class="ttc" id="aclass_client_html"><div class="ttname"><a href="class_client.html">Client</a></div><div class="ttdef"><b>Definition:</b> <a href="_client_8h_source.html#l00012">Client.h:12</a></div></div>
<div class="ttc" id="aclass_c_safe_map_html_a786c75f6b3b364940bd43e96ecda0d41"><div class="ttname"><a href="class_c_safe_map.html#a786c75f6b3b364940bd43e96ecda0d41">CSafeMap::Erase</a></div><div class="ttdeci">size_t Erase(const Kt &amp;key)</div><div class="ttdoc">删除元素</div><div class="ttdef"><b>Definition:</b> <a href="_safe_map_8h_source.html#l00029">SafeMap.h:29</a></div></div>
<div class="ttc" id="aclass_service_html_aceb078ac7bb78b45f21e0a3d2bf79735"><div class="ttname"><a href="class_service.html#aceb078ac7bb78b45f21e0a3d2bf79735">Service::AddClient</a></div><div class="ttdeci">void AddClient(const SharedPtr&lt; Client &gt; &amp;c)</div><div class="ttdoc">增加客户端</div><div class="ttdef"><b>Definition:</b> <a href="_service_8cpp_source.html#l00049">Service.cpp:49</a></div></div>
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.16
</small></address>
</body>
</html>
